import { View, Text, Image } from '@tarojs/components';
import { AtTag } from 'taro-ui';
import Price from '@/components/Price';
import './index.scss';

export default function ({ goodsInfo, onHandle = () => {} }) {
  const _onClick = () => {
    onHandle && onHandle();
  };
  return (
    <View className="goods-content" onClick={_onClick}>
      <Image className="goods-image" mode="aspectFit" src={goodsInfo.pic_url} />
      <View className="goods-title">{goodsInfo.goods_name}</View>
      <View className="coupon-content">
        <AtTag size="small">{goodsInfo.store_count}家在售</AtTag>
      </View>
      <View className="goods-bottom">
        <View className="price">
          <Price color="#333333" price={goodsInfo.min_price} />
          <Text className="price-intro">起</Text>
        </View>
        <Text className="sales">已售{goodsInfo.sales}</Text>
      </View>
    </View>
  );
}
